﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Collections.ObjectModel;

namespace StoryMaker.Common
{
    public class StoryModel : NotifyPropertyChangedBase
    {
        public StoryModel()
        {
            Pages = new ObservableCollection<Page>();
            Pages.Add(new Page());
        }

        private string _title;
        public string Title
        {
            get { return _title; }
            set
            {
                if (!EqualityComparer<string>.Default.Equals(_title, value))
                {
                    _title = value;
                    NotifyPropertyChanged("Title");
                }
            }
        }

        private ObservableCollection<Page> _pages;
        public ObservableCollection<Page> Pages
        {
            get { return _pages; }
            set
            {
                if (!EqualityComparer<ObservableCollection<Page>>.Default.Equals(_pages, value))
                {
                    _pages = value;
                    NotifyPropertyChanged("Pages");
                }
            }
        }

        public Page FirstPage
        {
            get { return Pages[0]; }
            set
            {
                if (!EqualityComparer<Page>.Default.Equals(Pages[0], value))
                {
                    Pages[0] = value;
                    NotifyPropertyChanged("FirstPage");
                }
            }
        }
    }
}
